home *** CD-ROM | disk | FTP | other *** search
- #include <Movies.h>
-
- void main(void)
- {
- OSErr err = noErr;
- OSType types;
- StandardFileReply reply;
- Movie newMovie;
- ThreeDeeDescriptionHandle sampleDescription = nil;
- short fref;
- AliasHandle alias = nil;
- long eof;
- Movie theMovie;
- Track theTrack;
- Media theMedia;
-
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- MaxApplZone();
-
- EnterMovies();
-
- // ask user for a file
- types = '3DMF';
- StandardGetFilePreview(nil, 1, &types, &reply);
- if (!reply.sfGood) return;
-
- // figure out the size of the file
- FSpOpenDF(&reply.sfFile, fsRdPerm, &fref);
- GetEOF(fref, &eof);
- FSClose(fref);
-
- // make an alias to the file (QuickTime term: data reference)
- NewAliasMinimal(&reply.sfFile, &alias);
-
- // make up a sample description for the 3d media
- sampleDescription = (ThreeDeeDescriptionHandle)NewHandleClear(sizeof(ThreeDeeDescription));
- if (err = MemError()) return;
- (**sampleDescription).descSize = sizeof(ThreeDeeDescription);
-
- // make up a movie, track, and media, very quickly
- theMovie = NewMovie(newMovieActive);
- theTrack = NewMovieTrack(theMovie, 320 << 16, 240 << 16, 0); // 320x240 pixels in size
- theMedia = NewTrackMedia(theTrack, 'qd3d', 1000, (Handle)alias, rAliasType); // make up a media that points to the 3dmf file
-
- // add the 3dmf file as a sample to the media (one second long)
- err = AddMediaSampleReference(theMedia, 0, eof, 1000, (SampleDescriptionHandle)sampleDescription,
- 1, 0, nil);
- if (err) return;
-
- // add the media into the track
- InsertMediaIntoTrack(theTrack, 0, 0, 1000, 1L << 16);
-
- // dispose unneed things
- DisposeHandle((Handle)alias);
- DisposeHandle((Handle)sampleDescription);
-
- // the movie is now ready for use... we'll just toss it on the system scrap to look at in movieplayer
- PutMovieOnScrap(theMovie, 0);
-
- // or you could write the movie to a file like so
- // writing the movie out in this way doesn't copy the contents of the 3DMF, but just references it
- if (0) {
- FSSpec fss;
- short resRef;
-
- FSMakeFSSpec(0, 0, "\p3D Movie File", &fss);
- err = CreateMovieFile(&fss, 'TVOD', -1, createMovieFileDeleteCurFile, &resRef, nil);
- if (err) return;
-
- err = AddMovieResource(theMovie, resRef, nil, nil);
- if (err) return;
-
- CloseMovieFile(resRef);
- }
-
-
- // toss that movie too (automatically tosses all tracks, media, etc).
- DisposeMovie(theMovie);
- }
-
-
-